<?php

/**
 * Reclamo filter form base class.
 *
 * @package    aeropostal
 * @subpackage filter
 * @author     Your name here
 */
abstract class BaseReclamoFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'fecha'         => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'numeroFactura' => new sfWidgetFormPropelChoice(array('model' => 'Factura', 'add_empty' => true)),
      'descripcion'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'estatus'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'numAprob'      => new sfWidgetFormFilterInput(),
      'fechaAprob'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'numNota'       => new sfWidgetFormFilterInput(),
      'fechaNota'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'tipoNota'      => new sfWidgetFormFilterInput(),
      'montoNota'     => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'fecha'         => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'numeroFactura' => new sfValidatorPropelChoice(array('required' => false, 'model' => 'Factura', 'column' => 'numero')),
      'descripcion'   => new sfValidatorPass(array('required' => false)),
      'estatus'       => new sfValidatorPass(array('required' => false)),
      'numAprob'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'fechaAprob'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'numNota'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'fechaNota'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'tipoNota'      => new sfValidatorPass(array('required' => false)),
      'montoNota'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
    ));

    $this->widgetSchema->setNameFormat('reclamo_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Reclamo';
  }

  public function getFields()
  {
    return array(
      'numero'        => 'Text',
      'fecha'         => 'Date',
      'numeroFactura' => 'ForeignKey',
      'descripcion'   => 'Text',
      'estatus'       => 'Text',
      'numAprob'      => 'Number',
      'fechaAprob'    => 'Date',
      'numNota'       => 'Number',
      'fechaNota'     => 'Date',
      'tipoNota'      => 'Text',
      'montoNota'     => 'Number',
    );
  }
}
